package collectionTest;

import com.google.common.collect.Lists;


import java.util.List;

/**
 * Created by IntelliJ IDEA.
 * User: liuliwei
 * Date: 2017-10-09
 * Time: 上午11:18
 * Description: 灰拷贝
 */
public class CollectionTest {
    public static void main(String[] args) {

        TestModel string =new TestModel(3);
        List<TestModel> a = Lists.newArrayList();
        a.add(string);

        List<TestModel> b = Lists.newArrayList(a);

        System.out.println("before");
        System.out.println(a);
        System.out.println(b);
        string.plus();
        System.out.println("after");
        System.out.println(a);
        System.out.println(b);



    }
}

class TestModel{
    private int value;

    public TestModel(int value) {
        this.value = value;
    }

    public void plus() {
        value ++;
    }

    @Override
    public String toString() {
        return "TestModel{" +
                "value=" + value +
                '}';
    }
}